package au.com.handsunited.web.validator.user;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import au.com.handsunited.web.command.user.UserInviteCommand;

/**
 * @author Object
 *
 */
public class UserInviteCommandValidator implements Validator {


	private static Logger logger = LoggerFactory.getLogger(UserEditProfileValidator.class);


	/**
	 *
	 */
	public UserInviteCommandValidator() {
	}

	/**
	 * @see org.springframework.validation.Validator#supports(java.lang.Class)
	 */
	@Override
	public boolean supports(Class clazz) {
		return clazz.isAssignableFrom(UserInviteCommand.class);

	}

	/**
	 * @see org.springframework.validation.Validator#validate(java.lang.Object, org.springframework.validation.Errors)
	 */
	@Override
	public void validate(Object target, Errors errors) {
		UserInviteCommand command = (UserInviteCommand) target;

		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "emailAddresses", "user.invite.emailAddresses.required", "Please enter at least one email address");
	}

}
